<template>
	<view class="container">
		<top-back-navbar position="fixed" :title="title" background=" "
			color="#fff"></top-back-navbar>
		<view class="top_box">
			<view class="hander" style="color: #fff;">
				{{hander}}
			</view>
			<view class="total" style="font-size: 31px;">
				{{mingxi_data.total}}
			</view>
		</view>
		<view class="list_box"  style="border-radius:10px 10px 0 0;">
			<ul>
				<li class="hander" style="padding: 10px 0;">
					<view class="">
						名称
					</view>
					<view class="">
						时间
					</view>
					<view class="">
						数量
					</view>
				
				</li>
			</ul>
		</view>
		<view class="list_box" style="height: 65vh;">
			<scroll-view scroll-y="true" @scrolltolower="scroll_end" class="scroll_view">
				<ul v-show="mingxi_data.list.length>0">
				
					<li v-for="item,index in mingxi_data.list" class="list_txt">
						<view class="">
							{{item.remark}}
						</view>
						<view class="">
							{{item.createtime}}
						</view>
						<view class="">
							{{item.num}}
						</view>
					</li>
				</ul>
				<view class="" v-show="mingxi_data.list.length==0">
					{{mingxi_data.message}}
				</view>
			</scroll-view>
		</view>

	</view>

</template>

<script>
	export default {
		data() {
			return {
				mingxi_data: {
					list: [],
					message: ''
				},
				title: '',
				hander: '',
				page:1,
				set_url:''
			};
		},
		onLoad: function(e) {

			var type = e.type
			var r = e.r
			var hander = e.hander
			this.hander = hander
			this.title = e.title
			var _this = this
			var id = uni.getStorage({
				key: 'openid',
				success: function(res) {
					var id = res.data
					_this.openid = id
					var openid = _this.openid
					var url = _this.$BASE_URL +
						'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&app=1&type=za&page=1&openid=' +
						openid + '&r=' + r + '&type=' + type;
						_this.set_url=url
					_this.get_data()
				},
				fail: function(err) {
					uni.hideLoading()
					uni.navigateTo({
						url: '/pages/login/login'
					});
				}
			});


		},
		methods: {
			scroll_end(e){
				
				this.page+=1
			
				this.get_data()
			},
			get_data() {
				
				var url = this.set_url
				uni.showLoading()
				var _this=this
				uni.request({
					url,
					data:{"page":_this.page},
					success: res => {
						var data = res.data
						var code = data.error
						
					
						
						
						if(res.data.error==1){
						
							uni.showToast({
								title: data.message,
								icon: 'none',
								duration: 1500,
								position: 'center',
							})
						}else{
							_this.mingxi_data.total=res.data.total
							_this.mingxi_data.list =[..._this.mingxi_data.list ,...data.list]
						}
					},
					fail: () => {},
					complete: () => {
						uni.hideLoading();
					}
				});
			},
			get_openid(id) {
				this.openid = id
			},
		}
	}
</script>

<style lang="less">
	page {
		height: 100%;
			background-color: #F4F4F4;
	}
	

	.container {

		height: 100vh;
		background: url('/static/zn/hander_bg.png')0 0 no-repeat;
		// background-size: 150% 106%;
		background-size: 100%;
		position: relative;
		padding: 31px 20px;
		overflow: auto;
	
	}

	.top_box {
	
		// background-size: 150% 106%;
		position: relative;
	
	
		margin-bottom: 26px;

		view {
			width: 100%;
			text-align: center;
			font-size: 16px;
			color: #515089;
			font-weight: 700;
		}
		.hander{
			color: #fff;
			font-weight: 800;
			font-size: 18px;
		}
		.total{
			
			background: linear-gradient(to bottom, #FBEDB9, #FFB85C, );
			align-items: center;
			background-clip: text;
			color: transparent;
			font-weight: 800;
		}
	}

	.list_box {
		width: 100%;
		
		overflow: auto;
		position: relative;
		box-shadow: 0 0 0 #000;
		background-color: #fff;
		border-radius:0 0 10px 10px;
		ul {
			width: 100%;
			padding: 0;
			
		}

		li {
			list-style: none;
			display: flex;
			width: 100%;
			justify-content: space-around;
			// padding: 15px 0;
			
			
			view {
				width: 33.333%;
				color: #000;
				text-align: center;
			}

		}

		
		.hander {
		
			background-color: #F6F6F6;
			border-radius: 10px 10px 0 0;
			view {
				color: #000;
				font-weight: 800;
			}

		}
	}
	.scroll_view{
		width: 100%;
		max-height: calc(100vh - 175px);
	
	
	}
	.list_txt{
		view{
			font-size: 12px !important;
		}
	}
</style>